<!DOCTYPE html>
<html>
<head>
   
    <title>直立训练</title>
    <meta charset="UTF-8">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/5.10.3/math.min.js"></script>
    <link rel="stylesheet" href="../css/ut.css"></link>
</head>
<body>
    <div class="bg">
        <img src="../img/bg2.jpg" style="height: 450px;width: 100%;">
    </div>
    <div class="text">
        <p>直立训练治疗儿童血管迷走性晕厥疗效预测</p>
    </div>
    
    <div class="age">
        
        &nbsp;&nbsp;&nbsp;Age (year):&nbsp;&nbsp;<input id="age" type="number" class="a" any="年龄">
    </div>
    <br>
    <div class="rssam">
        
        rMSSD (ms):&nbsp;&nbsp;<input id="rmssd" type="number" class="rm" any="RMSSD">
        <br><br>
        
        
    </div>

    <div class="butt">
        <button onclick="calculate()" style="padding: 5px 10px;">提交</button>
    </div>
    
    <div class="r">
        <p id="result1" style="text-align: center;"></p><br>
   
    </div>
    <div class="r-box" id="result">
        
    </div>
    <div class="box">
        <div class="text2">
            <p>注释：<br>
            Age：患者年龄，单位：岁。<br>
            rMSSD：全程相邻NN间期之差的均方根值，单位：毫秒。</p>
        </div>
    </div>

    <div class="home">
        <button class="button1"><a style="text-decoration: none;color: black;" href="./index.html">首页</a></button>
    </div>
    <script>
        function calculate() {
            var age = document.getElementById('age').value;
            var rmssd = document.getElementById('rmssd').value;
            var y = -5.782 + 0.18 * age + 0.065 * rmssd;
            var p = 1 / (1 + Math.exp(-y));
            document.getElementById('result1').innerText = 'p值：' + p.toFixed(3);
            var result;
            if (p >= 0.489) {
                result = '预测治疗有效，推荐直立训练治疗。';
            } else {
                result = '预测治疗无效，不推荐直立训练治疗。';
            }
            document.getElementById('result').innerText = result;  
        }
    </script>
</body>
</html>
